package com.cmdi.feign;

import com.cmdi.constant.ServiceNameConstants;
import com.cmdi.domain.JwtToken;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Description: OAuth2FeignClient
 * @Author: gaozb
 */
@FeignClient(value = ServiceNameConstants.AUTH_SERVICE_NAME,
        configuration = {KeepErrMsgConfiguration.class},
        fallbackFactory = OAuth2FeignClientFallBackFactory.class)
public interface OAuth2FeignClient {

    @PostMapping("/oauth/token")
    ResponseEntity<JwtToken> getToken(
            // 授权类型
            @RequestParam("grant_type") String grantType ,
            // 用户名
            @RequestParam("username") String username ,
            // 用户的密码
            @RequestParam("password") String  password ,
            // 登录的类型
            @RequestParam("login_type")  String loginType,
            // 客户端id
            @RequestParam("client_id")  String clientId,
            // 客户端密码
            @RequestParam("client_secret") String clientSecret,
            // 客户端密码
            @RequestParam("refresh_token") String refreshToken
    );

}